//C09:Dominance2.cpp
#include <iostream>
using namespace std;

class A
{
    public:
        virtual ~A() {}
        virtual void f() { cout << "A::f\n"; }
};

class B : virtual public A
{
    public:
        void f() { cout << "B::f\n"; }
};
class C : public B {};
class D : public C, virtual public A {};

int main(void)
{
    B* p = new D;
    p->f();    // Call B::f()
    delete p;
}